/**
 * 
 */
package optimization.naturalOptimization.terminationCriterion;

import optimization.naturalOptimization.NaturalOptimization;

/**
 * This class provides a termination criterion in dependence on iteration steps.
 * 
 * @author Kevin Wagner
 * @version 1.0
 */
public class GenerationTermination extends TerminationCriterion {

	/**
	 * Creates a new Termination Criterion with a given parent optimization.
	 * 
	 * @param opt
	 *            parent optimization
	 */
	public GenerationTermination(NaturalOptimization opt) {
		super(opt);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * optimization.naturalOptimization.terminationCriterion.TerminationCriterion
	 * #isFinished()
	 */
	@Override
	public boolean isFinished() {
		if (getParentOptimization().getCurrentGeneration() == getParentOptimization()
				.getGenerations()) {
			return true;
		}
		return false;
	}

	@Override
	public String getIndentification() {
		return "Generation Termination Criterion\n  " + "Limit: "
				+ getParentOptimization().getGenerations();
	}

}
